home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 6_17.lha / 6_17 / 6_17a1.c < prev    next >
Text File  |  1993-08-08  |  414b  |  17 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. / vector x(15); or vector x(15, 4.5);
  6. include <error.h>
  7. ector::vector(int size, float init)
  8.  
  9.    if (size <= 0)
  10. error("non-positive vector size");
  11.    p = new vrep;
  12.    p->f = new float[p->length = size];
  13.    for (int i = 0; i < size; i++)
  14. p->f[i] = init;
  15.    p->refcnt = 1;
  16.  
  17.